﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Yxinmt.SmarterStreaming
{
    /// <summary>
    /// NTSmartLog 的摘要说明。
    /// </summary>
    public class NTSmartLog
    {
        public struct SmartLogAPI
        {
            /*
             * 设置日志目录，Windows平台请设置宽字符，比如L"D:\\xxx\gg"
             */
            [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
            public delegate UInt32 SetPath(IntPtr path);

            /*
             * 设置日志等级，level请参考SL_LOG_LEVEL
             */
            [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
            public delegate UInt32 SetLevel(IntPtr path);

            /*
             * 将缓冲全部写入
             */
            [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
            public delegate UInt32 Flush();

            /*
             * 万能接口, 设置参数， 大多数问题， 这些接口都能解决
             */
            [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
            public delegate UInt32 SetParam(UInt32 id, IntPtr pData);

            /*
             * 万能接口, 得到参数， 大多数问题，这些接口都能解决
             */
            [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
            public delegate UInt32 GetParam(UInt32 id, IntPtr pData);

        }

        [DllImport(@"SmartLog.dll")]
        public static extern UInt32 GetSmartLogAPI(ref SmartLogAPI pAPI);

    }
}
